package com.lxb.blog.service.ImpI;

import com.lxb.blog.dao.CommentRepository;
import com.lxb.blog.entity.Comment;
import com.lxb.blog.service.AdminCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class AdminCommentServiceIpml  implements AdminCommentService{

    @Autowired
    private CommentRepository commentRepository;

    @Override
    public Page<Comment> listComments(Pageable pageable) {
        return commentRepository.findAll(pageable);
    }

    @Transactional
    @Override
    public void delete(Integer id) {

        commentRepository.deleteById(id);
    }
}
